<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CodeIgniter Project Documentation Template</title>

<style type='text/css' media='all'>@import url('./userguide.css');</style>
<link rel='stylesheet' type='text/css' media='all' href='../userguide.css' />

<meta http-equiv='expires' content='-1' />
<meta http-equiv= 'pragma' content='no-cache' />
<meta name='robots' content='all' />

</head>
<body>

<!-- START NAVIGATION -->
<div id="nav"><div id="nav_inner"></div></div>
<div id="nav2"><a name="top">&nbsp;</a></div>
<div id="masthead">
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
<td><h1>AuthenticatedController</h1></td>
<td id="breadcrumb_right"><a href="#">Right Breadcrumb</a></td>
</tr>
</table>
</div>
<!-- END NAVIGATION -->


<!-- START BREADCRUMB -->
<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
<tr>
<td id="breadcrumb">
<a href="http://example.com/">Project Home</a> &nbsp;&#8250;&nbsp;
<a href="#">User Guide Home</a> &nbsp;&#8250;&nbsp;
AuthenticatedController
</td>
<td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="example.com/user_guide/" />Search Project User Guide&nbsp; <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" />&nbsp;<input type="submit" class="submit" name="sa" value="Go" /></form></td>
</tr>
</table>
<!-- END BREADCRUMB -->

<br clear="all" />


<!-- START CONTENT -->
<div id="content">


<h1>AuthenticatedController</h1>

<p><b>AuthenticatedController</b> is an authentication framework for CodeIgniter.</p>

<h2>Goal</h2>

<p><b>AuthenticatedController's</b> goal is to provide authentication and authorization services to a CodeIgniter application in the least intrusive manner. For most cases, simply subclassing a Controller as AuthenticatedController will provide security.</p>

<h2>Features</h2>

<p>AuthenticatedControlller provides the following:</p>

<ul>
	<li>Extend any Controller as AuthenticatedController to add authentication and authorization services.</li>
	<li>Access Control List (ACL) provides controller & method granularity.</li>
	<li>Authenticator plug-ins provide extensible access to various data sources. This may include MySQL, Config File, or LDAP</li>
	<li>Asset controller provides AuthenticatedController services to static assets like JavaScript or image files.</li>
</ul>

<h2>Installation</h2>

<p>AuthenticatedController requires files to be installed in your application directory.</p>

<code>
	cd CodeIgniter_2.0.1/application<br />
	<br />
	tar -xvf AuthenticatedController.tar
</code>

<p>AuthenticatedController files reside in the following <b>auth</b> directories:</p>


<table cellpadding="0" cellspacing="1" border="0" style="width:100%" class="tableborder">
<tr>
	<th>Directory</th>
	<th>Provides</th>
</tr>
<tr>
	<td class="td"><strong>application/config/auth/</strong></td>
	<td class="td">Configuration Files</td>
</tr>
<tr>
	<td class="td"><strong>application/controllers/auth/</strong></td>
	<td class="td">Authentication controllers</td>
</tr>
<tr>
	<td class="td"><strong>application/libraries/auth/</strong></td>
	<td class="td">AuthenticatedController, AssetController, and Authenticators</td>
</tr>
<tr>
	<td class="td"><strong>application/views/auth/</strong></td>
	<td class="td">Views</td>
</tr>
</table>

<h2>Configuration</h2>

<p>AuthenticatedController requires files to be installed in your application directory. These files are:</p>

<h3>Encrypt Session Cookie</h3>

<p>In config/config.php, specify an encryption key.</p>

<code>
$config['encryption_key'] = '<dfn>RANDON_ENCRYPTION_KEY</dfn>';
</code>

<p>In config/config.php, enable cookie encryption.</p>

<code>
$config['sess_encrypt_cookie']	= <dfn>true</dfn>;
</code>

<h3>Controller</h3>

<p>Every controller that requires services of AuthenticatedController should have these two lines added.</p>

<ul>
	<li>require to load AuthentcatedController class</li>
	<li>extend AuthenticatedController</li>
</ul>

<code>
<dfn>require(APPPATH."libraries/auth/AuthenticatedController.php");</dfn><br />
<br />
<dfn>class App extends AuthenticatedController</dfn> {<br />
<br />
function index()<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this->load->view('app');<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}<br />
</code>

<p>Aside from these two modifications, AuthenticatedControllers follow the same rules as traditional Controllers.</p>

<h2>Template</h2>

<p class="important"><strong>Important:</strong>&nbsp; This is an important note with <kbd>EMPHASIS</kbd>.</p>


<p>Features:</p>

<ul>
	<li>Foo</li>
	<li>Bar</li>
</ul>

<h2>Usage Heading</h2>

<p>Within a text string, <var>highlight variables</var> using <var>&lt;var&gt;&lt;/var&gt;</var> tags, and <dfn>highlight code</dfn> using the <dfn>&lt;dfn&gt;&lt;/dfn&gt;</dfn> tags.</p>

<h3>Sub-heading</h3>

<p>Put code examples within <dfn>&lt;code&gt;&lt;/code&gt;</dfn> tags:</p>

<code>
	$this->load->library('foo');<br />
	<br />
	$this->foo->bar('bat');
</code>


<h2>Table Preferences</h2>

<p>Use tables where appropriate for long lists of preferences.</p>


<table cellpadding="0" cellspacing="1" border="0" style="width:100%" class="tableborder">
<tr>
	<th>Preference</th>
	<th>Default&nbsp;Value</th>
	<th>Options</th>
	<th>Description</th>
</tr>
<tr>
	<td class="td"><strong>foo</strong></td>
	<td class="td">Foo</td>
	<td class="td">None</td>
	<td class="td">Description of foo.</td>
</tr>
<tr>
	<td class="td"><strong>bar</strong></td>
	<td class="td">Bar</td>
	<td class="td">bat, bag, or bak</td>
	<td class="td">Description of bar.</td>
</tr>
</table>

<h2>Foo Function Reference</h2>

<h3>$this->foo->bar()</h3>
<p>Description</p>
<code>$this->foo->bar('<var>baz</var>')</code>

</div>
<!-- END CONTENT -->


<div id="footer">
<p>
Previous Topic:&nbsp;&nbsp;<a href="#">Previous Class</a>
&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
<a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
<a href="#">User Guide Home</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
Next Topic:&nbsp;&nbsp;<a href="#">Next Class</a>
</p>
<p><a href="http://codeigniter.com">CodeIgniter</a> &nbsp;&middot;&nbsp; Copyright &#169; 2006 - 2011 &nbsp;&middot;&nbsp; <a href="http://ellislab.com/">EllisLab, Inc.</a></p>
</div>

</body>
</html>